package com.bilibili.server.service;

import com.bilibili.dubbo.api.mongo.BaiduApi;
import com.bilibili.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author HuangRongFu
 * 2021/11/25 星期四7:57 下午
 */

@Service
public class BaiduService {

    @DubboReference
    private BaiduApi baiduApi;

    /**
     * 上报地理位置
     *
     * @param paramMap
     * @Return: null
     */
    public void uploadLocation(Map<String, Object> paramMap) {

        //调用api
        Double latitude =(Double) paramMap.get("latitude");//纬度
        Double longitude =(Double) paramMap.get("longitude");//经度
        String address = (String) paramMap.get("address");//位置名称

        baiduApi.save(UserHolder.getUserId(), latitude, longitude, address);

    }
}
